package com.heima.controller;

import com.heima.pojo.User;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    //get请求 用来查询
    @GetMapping("/{id}")
    public String testGet(@PathVariable("id") Integer id){
        System.out.println("testGet"+id);
        return "success";
    }

    //post请求 用来新增
    @PostMapping("/")
    public String testPost(@RequestBody User user){
        System.out.println("testPost"+user);
        return "success";
    }

    //put请求 用来修改
    @PutMapping("/")
    public String testPut(@RequestBody User user){
        System.out.println("testPut"+user);
        return "success";
    }

    //delete请求 用来删除
    @DeleteMapping("/{id}")
    public String testDelete(@PathVariable("id") Integer id){
        System.out.println("testDelete"+id);
        return "success";
    }

}
